﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;
using BukkitSharp.org.util;

namespace BukkitSharp.org.util
{
    /*
     * This method is used for file copying.
     * 
     * InFile - The source file
     * OutFile - The target file
     * 
     * Will return true on success.
     */

    class FileUtil
    {
        public static bool copy(string inFile, string outFile)
        {
            try
            {
                if (!File.Exists(inFile))
                {
                    Log_Util.Log(3, "Could not find " + inFile + "for copying!");
                    return false; // No file found, nothing to copy...
                }

                File.Copy(inFile, outFile);
                return true; // Nothing has failed to the copying seems to have succeeded.
            }
            catch (IOException ioe)
            {
                Log_Util.Log(2, Convert.ToString(ioe));
                return false; // Copying failed, returning false.
            }
        }
    }
}
